﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DianJu : MonoBehaviour 
{

    public AudioClip alarm;
    private Animator ani;
    public AudioClip luodisheng;
    public AudioClip guanmensheng;
    void Awake()
    {
        ani = transform.GetComponent<Animator>();
    }

    /// <summary>
    /// 动画开始播放
    /// </summary>
    public void PlayAnimation()
    {
        ani.SetBool("isPlay", true);
    }


    /// <summary>
    /// 动画暂停
    /// </summary>
    public void PauseAnimation()
    {
        ani.speed = 0;
    }

    /// <summary>
    /// 动画继续播放
    /// </summary>
    public void Resume()
    {
        ani.speed = 1;
    }


    /// <summary>
    /// 电梯播放报警
    /// </summary>
    public void PlayAlarm()
    {
        SoundManager.instance.PlaySoundEffect(alarm,true);
    }


    /// <summary>
    /// 播放关门声
    /// </summary>
    public void PlayStopDoor()
    {
        SoundManager.instance.PlaySoundEffect(guanmensheng);//////////////////////////////
    }


    /// <summary>
    /// 电梯停止报警，动画结束回调
    /// </summary>
    public void StopAlarm()
    {
        SoundManager.instance.StopSoundEffect(alarm);
        SoundManager.instance.PlaySoundEffect(luodisheng);
    }
}
